package DesignPatern.A21_解释器模式.A02_抽象模式;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Du
 * @Date: 2021/8/12 11:46
 */
public class A01_Main
{
    public static void main(String[] args)
    {
        Context context = new Context();
        context.setInput("1");
        List<Expression> list = new ArrayList<>();
        
        list.add(new TerminalExpression());
        list.add(new NoTerminalExpression());
        
        int sum = 0;
        for (Expression abstractExpression : list)
        {
            sum += (int)abstractExpression.interpreter(context);
        }
        System.out.println(sum);
    }
}
